<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>条件渲染</title>
  <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
  <div id="app">
    <!-- v-if 为false不会被渲染进dom-->
    <div v-if="render">成功渲染</div>
    <h1 v-else>意外情况!</h1>
    <!-- v-show 为false则设置样式display为none-->
    <div v-show="render">成功渲染</div>
    <!-- template 不会被渲染进dom -->
    <template v-if="render">成功渲染</template>
    <template v-else-if="noRender">渲染失败😢</template>
    <template v-else>意外情况!</template>
  </div>
  <script>
    const App = {
      data () {
        return {
          noRender: true
        }
      }
    }
    Vue.createApp(App).mount("#app")
  </script>
</body>

</html>